<template>
	<el-card class="box-card">
		<div slot="header" class="clearfix">
			<h1>文档列表</h1>
		</div>
		<div v-for="item in documentList" :key="item.id" class="text item">
			<el-link :href="'/documents/'+item.id">{{item.title}}</el-link>
		</div>
	</el-card>
</template>

<script>
	import NavbarTop from './NavbarTop.vue'
	import NavbarLeft from './NavbarLeft.vue'
	export default{
		data() {
			return {
				documentList : null
			}
		},
		components:{
			NavbarTop,NavbarLeft
		},
		mounted() {
			this.getDocumentList()
		},
		methods:{
			async getDocumentList (){
				await this.$http.get('http://127.0.0.1:8000/documents/',{
					params: {
						page: 1,
						page_size: 10
					}
				}).then((result)=>{
					// console.log(result)
					this.documentList = result.data.results
					console.log(this.documentList)
				})
			}
		}
	}
</script>

<style>
</style>
